<cfsetting enablecfoutputonly="true" />
<!--- @@displayname: Standard Page Display for jcFarcryFlvFile --->
<!--- @@author: Jeff Coughlin (jeff[at]jeffcoughlin[dot]com) --->

<cfimport taglib="/farcry/core/tags/webskin" prefix="skin" />
<cfimport taglib="../../tags/webskin" prefix="myskin" />

<cfif application.config.jcfarcryflvplayer.bLoadPluginCssFile is true or application.config.jcfarcryflvplayer.bLoadJsFile is true>
  <myskin:defaultHtmlHead bLoadPluginCssFile="#application.config.jcfarcryflvplayer.bLoadPluginCssFile#" bLoadJsFile="#application.config.jcfarcryflvplayer.bLoadJsFile#" />
</cfif>

<!--- These two settings don't actually exist in jcFarCryFlvFile.cfc, but if you'd like to take advantage of them you can extend the object in your project and use these two settings --->
<cfparam name="stObj.flashBgColor" default="##FFFFFF" />
<cfparam name="stObj.flashQuality" default="high" />

<!--- (to support both Advanced and webroot installations) Check if stObj.imgBackground starts with a forward slash (/).  If yes, remove it to conform to FarCry output standards --->
<cfif left(stObj.imgBackground, 1) eq "/">
  <cfset stObj.imgBackground = right(stObj.imgBackground, len(stObj.imgBackground) -1) />
</cfif>

<!--- Code for SWFObject 2.0+ --->
<!--- Due to a change in SWFObject 2.0, we are now using nested DIVs (SWFObject 2.0 "replaces" the block element with an object tag) --->
<!--- MUST have width in div (or CSS for div) or IE6 clear's right if also using Dean Edwards IE7 script --->
<cfoutput>
  <div class="jcFarcryFlvFileParent" style="width: #stObj.flvWidth#px;">
    <div id="#stObj.objectId#" class="jcFarcryFlvFile">
    </div>
  </div></cfoutput>

<cfsavecontent variable="jcFarcryFlvFile_js">
<cfoutput>
  <script type="text/javascript">
    // <![CDATA[
    var flashvars = {};
    // load the file
    flashvars.file = "#application.url.webroot#/files/#stObj.flvFile#";</cfoutput>
    <cfif stObj.imgSource neq ""><cfoutput>
    // load default image
    flashvars.image = "#application.url.webroot#/#stObj.imgBackground#";</cfoutput>
    </cfif><cfoutput>
     // Load width and Height again to fix IE bug
    flashvars.width = "#stObj.flvWidth#";
    flashvars.height = "#stObj.flvHeight#";</cfoutput>
    <cfif stObj.bPlayerAutoHideControls is true><cfoutput>
    // Auto-hide player controls
    flashvars.displayheight = "#stObj.flvHeight#";</cfoutput>
    </cfif>
    <cfoutput>
    // Set colors</cfoutput>
    <cfif stObj.playerBackColor neq ""><cfoutput>
    flashvars.backcolor = "0x#stObj.playerBackColor#";</cfoutput>
    </cfif>
    <cfif stObj.playerFrontColor neq ""><cfoutput>
    flashvars.frontcolor = "0x#stObj.playerFrontColor#";</cfoutput>
    </cfif>
    <cfif stObj.playerLightColor neq ""><cfoutput>
    flashvars.lightcolor = "0x#stObj.playerLightColor#";</cfoutput>
    </cfif>
    <cfif stObj.playerVolume neq ""><cfoutput>
    // Volume (0-100)
    flashvars.volume = "#stObj.playerVolume#";</cfoutput>
    </cfif>
    <cfif stObj.bPlayerShowStopButton is true><cfoutput>
    // Show stop button?
    flashvars.showstop = "true";</cfoutput>
    </cfif>
    <cfoutput>
    // Autostart?
    flashvars.autostart = "false";
    
    // Add custom variables
    var params = {};
    params.allowScriptAccess = "always";
    params.quality = "#stObj.flashQuality#";
    params.allowfullscreen = "true";</cfoutput>
    <cfif stObj.flashBgColor neq ""><cfoutput>
    params.bgcolor = "#stObj.flashBgColor#";</cfoutput>
    </cfif>
    <cfif cgi.http_user_agent contains "Firefox"
      or cgi.http_user_agent contains "Safari"
      or cgi.http_user_agent contains "Camino"><cfoutput>
    params.wmode = "opaque";</cfoutput>
    <cfelseif cgi.http_user_agent contains "MSIE"><cfoutput>
    params.wmode = "transparent";</cfoutput>
    <cfelse><cfoutput>
    params.wmode = "transparent";</cfoutput>
    </cfif><cfoutput>

    var attributes = {};
    
    swfobject.embedSWF("#application.config.jcfarcryflvplayer.urlPluginroot#/includes/mediaplayer.swf", "#stObj.objectId#", "#stObj.flvWidth#", "#stObj.flvHeight#", "#stObj.flashVersion#","#application.config.jcfarcryflvplayer.urlExpressinstall#", flashvars, params, attributes);
    // ]]>
  </script>
</cfoutput>
</cfsavecontent>

<!--- <cfhtmlhead text="#variables.jcFarcryFlvFile_js#" /> --->
<!--- Warning: the htmlhead tag adds a lot of tabbed whitespace.  There's nothing I can do about it (I need the htmlHead tag to overcome caching issues using the objectBroker) --->
<skin:htmlHead>
  <cfoutput>#variables.jcFarcryFlvFile_js#</cfoutput>
</skin:htmlHead>

<cfsetting enablecfoutputonly="false" />